﻿using System;
using System.Data;
using System.Collections.Generic;

using BOMS.Model;
namespace BOMS.BLL
{
    /// <summary>
    /// 业务逻辑类WarningDealwith 的摘要说明。
    /// </summary>
    public class WarningDealwith
    {
        private readonly BOMS.DAL.WarningDealwith dal = new BOMS.DAL.WarningDealwith();
        public WarningDealwith()
        { }
        #region  成员方法
       
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(BOMS.Model.WarningDealwith model)
        {
            return dal.Add(model);
        }

       

        

      

        ///// <summary>
        ///// 得到一个对象实体，从缓存中。
        ///// </summary>
        //public BOMS.Model.WarningDealwith GetModelByCache(int ID)
        //{

        //    string CacheKey = "WarningDealwithModel-" + ID;
        //    object objModel = LTP.Common.DataCache.GetCache(CacheKey);
        //    if (objModel == null)
        //    {
        //        try
        //        {
        //            objModel = dal.GetModel(ID);
        //            if (objModel != null)
        //            {
        //                int ModelCache = LTP.Common.ConfigHelper.GetConfigInt("ModelCache");
        //                LTP.Common.DataCache.SetCache(CacheKey, objModel, DateTime.Now.AddMinutes(ModelCache), TimeSpan.Zero);
        //            }
        //        }
        //        catch { }
        //    }
        //    return (BOMS.Model.WarningDealwith)objModel;
        //}

        
       
      
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List<BOMS.Model.WarningDealwith> DataTableToList(DataTable dt)
        {
            List<BOMS.Model.WarningDealwith> modelList = new List<BOMS.Model.WarningDealwith>();
            int rowsCount = dt.Rows.Count;
            if (rowsCount > 0)
            {
                BOMS.Model.WarningDealwith model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new BOMS.Model.WarningDealwith();
                    if (dt.Rows[n]["ID"].ToString() != "")
                    {
                        model.ID = int.Parse(dt.Rows[n]["ID"].ToString());
                    }
                    if (dt.Rows[n]["WarningID"].ToString() != "")
                    {
                        model.WarningID = int.Parse(dt.Rows[n]["WarningID"].ToString());
                    }
                    model.Operator = dt.Rows[n]["Operator"].ToString();
                    model.OperateDescr = dt.Rows[n]["OperateDescr"].ToString();
                    if (dt.Rows[n]["CreateTime"].ToString() != "")
                    {
                        model.CreateTime = DateTime.Parse(dt.Rows[n]["CreateTime"].ToString());
                    }
                    if (dt.Rows[n]["CreatorID"].ToString() != "")
                    {
                        model.CreatorID = int.Parse(dt.Rows[n]["CreatorID"].ToString());
                    }
                    modelList.Add(model);
                }
            }
            return modelList;
        }

        

        /// <summary>
        /// 获得数据列表
        /// </summary>
        //public DataSet GetList(int PageSize,int PageIndex,string strWhere)
        //{
        //return dal.GetList(PageSize,PageIndex,strWhere);
        //}

        #endregion  成员方法
    }
}

